package cn.qn.framwork.utils;

import cn.qn.dto.ResponseDTO;
import com.alibaba.fastjson.JSONObject;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class OutUtils {
    public static int SUCCESS_CODE=0;
    public static int ERROR_CODE=1;
    public static int TOKEN_ERROR_CODE=5544;
    public static void print(int code, String message, Object data, HttpServletResponse response) throws IOException {
        PrintWriter out = response.getWriter();
        ResponseDTO dto = new ResponseDTO(code,message,data);
        out.write(JSONObject.toJSONString(dto));
        out.flush();
        out.close();
    }
}
